package oa.quartz;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTasks{

    //固定频率执行，例如每3秒执行一次
    @Scheduled(fixedRate = 1000 * 3)
    public void reportCurrentTime(){
        System.out.println ("检测超时订单并回收商品");
    }

    //定制执行，例如每1分钟执行一次
    //可以固定每天凌晨12点执行
    @Scheduled(cron = "0 */1 * * * * ")
    public void reportCurrentByCron(){
        System.out.println ("凌晨12点开始将订单数据从mysql导到hbase");
    }

}
